package com.hnust.api;

import com.github.lianjiatech.retrofit.spring.boot.annotation.RetrofitClient;
import com.hnust.domain.*;
//import jdk.nashorn.internal.objects.annotations.Getter;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import org.springframework.stereotype.Component;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.http.*;

import java.io.InputStream;
import java.util.List;
import java.util.Map;

import com.github.lianjiatech.retrofit.spring.boot.annotation.RetrofitClient;
import com.hnust.domain.Result;
import com.hnust.domain.Visual2;
import org.springframework.stereotype.Component;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;

import java.io.File;
import java.io.FileInputStream;
import java.util.List;

/**
 * 创建人：zhangRuWang
 * 创建时间：2020/10/28
 * 描述：
 */
@RetrofitClient(baseUrl = "${retrofit.baseUrl}",poolName = "test2",connectTimeoutMs = 50000,writeTimeoutMs = 50000,readTimeoutMs = 50000)
@Component
public interface TestPaperApi {
    @GET("/api/subject/getCourseData")
    Call<Result<List<CourseData>>> getCourseData(@Query("id") String id,@Query("token") String token);

    //获取该课程的题型
    @GET("/api/teacher/testpaper/getQuesTypeList")
    Call<Result<List<QuestionType>>> getCourseQuesList(@Query("token")String token,@Query("id") String id);  //ID为courseId

    //获取该课程对应的题型题库
    @GET("/api/teacher/testpaper/getCourseQuesList")
    Call<Result<SubjectInfo>> getQuestion(@Query("token")String token,@Query("course_id")String course_id,@Query("type_id")String type_id,@Query("now_page")String now_page);

    //搜索题目
    @GET("/api/teacher/testpaper/getQuesByCon")
    Call<Result<SubjectInfo>> getQuesByCon(@Query("token")String token,@Query("id")String id,@Query("course_id")String course_id,@Query("type_id")String type_id,@Query("keyword")String keyword,@Query("diff")Integer diff,@Query("now_page")String now_page);

    //试卷查重
    @GET("/api/teacher/testpaper/checkPaperRepeat")
    Call<Result<List<RepeatQues>>> checkPaperRepeat(@Query("token") String token,@Query("id") String id,@Query("course_id")String course_id,@Query("subject_ids")List<String> subject_ids);

    //题目设为隐藏
    @GET("/api/teacher/testpaper/setDisableQue")
    Call<Result<Boolean>> setDiasbleQue(@Query("token") String token,@Query("subject_ids")List<String> subject_ids);

    //保存成生成试卷
    @POST("/download/create")
    Call<Result<String>> create(@Body GeneratePaperInfoRecord generatePaperInfoRecord);

    //下载试卷PDF
    @GET("/download/paperpdf")
    Call<ResponseBody> getPaperpic(@Query("paperId") String paperId);

    //下载试卷WORD
    @GET("/download/paperdocx")
    Call<ResponseBody> getPaperdocx(@Query("paperId") String paperId);

    //下载试卷答案
    @GET("/download/paperanswer")
    Call<ResponseBody> getPaperAnswerdocx(@Query("paperId") String paperId);

    //下载出题计划表
    @GET("/download/paperplan")
    Call<ResponseBody> getPaperPlandocx(@Query("paperId") String paperId);

    //自动生成试卷获取题目
    @Multipart
    @POST("/api/teacher/testpaper/getAutoPaper")
    Call<Result<List<SubjectData>>> getAutoPaper(@Part("course_id")String course_id, @Part("list") RequestBody list, @Part("token") String token);

    @GET("download/question")
    Call<Result<File>> getTem();

    //根据课程搜索试卷
    @GET("api/teacher/testpaper/getPaperList")
    Call<Result<PaperInfo>> getPaperList(@Query("token") String token,@Query("id") String id,@Query("course_id") String course_id,@Query("now_page") int now_page);

    //删除试卷
    @GET("api/teacher/testpaper/delTestPaper")
    Call<Result<Integer>> delTestPaper(@Query("token") String token,@Query("paper_ids") List<String> paper_ids);

    //将试卷设为样卷
    @GET("api/teacher/testpaper/changePaperType")
    Call<Result<Integer>> changePaperType(@Query("token") String token,@Query("paper_ids") List<String> paper_id);

    //预览试卷
    @GET("/download/paperpic")
    Call<Result<Object>> getPaperPreview(@Query("paperId") String paperId );

    //取消样卷
    @GET("api/teacher/testpaper/removePaperType")
    Call<Result<Integer>> removePaperType(@Query("token") String token,@Query("paper_ids")  List<String> paper_ids);
}
